import App from './App'
import { createSSRApp } from 'vue'
import api from './config/api'

export function createApp() {
  const app = createSSRApp(App)
  
  // 挂载统一的API
  app.config.globalProperties.$api = api
  
  // 添加错误处理
  app.config.errorHandler = (err, vm, info) => {
    console.error('Vue Error:', err)
    console.error('Error Info:', info)
  }
  
  // 添加警告处理
  app.config.warnHandler = (msg, vm, trace) => {
    console.warn('Vue Warning:', msg)
    console.warn('Warning Trace:', trace)
  }

  return {
    app
  }
}